#include "widget.h"
#include "ui_widget.h"
#include "mylabel.h"
#include <QLineEdit>
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
//    mylabel* label = new mylabel(this);
//    label->setText("Hello world");
//    QLineEdit*line = new QLineEdit(this);
//    line->setText("hello world");
//    connect(ui->pushButton,&QPushButton::clicked,this,&Widget::handleClick);
    mybutton = new QPushButton(this);
    mybutton->setText("hello world");
    connect(mybutton,&QPushButton::clicked,this,&Widget::handled);
}

Widget::~Widget()
{s
    delete ui;
}

void Widget::handled()
{
    if(mybutton->text()=="hello world")
    {
        mybutton->setText("hello Qt");
    }
    else
    {
        mybutton->setText("hello world");
    }
}

//void Widget::handleClick()
//{
//    if(ui->pushButton->text()=="点一下吧")
//    {
//        ui->pushButton->setText("再点一下");
//    }
//    else
//    {
//        ui->pushButton->setText("点一下吧");
//    }
//}

